import { BaseEntity, Column, CreateDateColumn, Index, UpdateDateColumn } from 'typeorm';

export class BasicEntity extends BaseEntity {
  @Column('uuid', { name: 'created_by', comment: '创建人Uuid', nullable: true })
  createdBy: string;

  @CreateDateColumn({ name: 'created_at', comment: '创建时间(typeorm自动生成)' })
  @Index()
  createdAt: Date;

  @Column('uuid', { name: 'updated_by', comment: '更新人Uuid', nullable: true })
  updatedBy: string;

  @UpdateDateColumn({ name: 'updated_at', comment: '更新时间(typeorm自动生成)' })
  @Index()
  updatedAt: Date;

  @Column('boolean', { name: 'deleted', comment: '是否已被删除(支持软删除)', default: false })
  deleted: boolean;
}
